package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.common.core.domain.entity.PlError;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.IPlErrorService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 批量录数据错误 Controller
 * 
 * @author ess
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/system/plError")
public class PlErrorController extends BaseController
{
    @Autowired
    private IPlErrorService plErrorService;

    /**
     * 查询批量录数据错误 列表
     */
    @PreAuthorize("@ss.hasPermi('system:plError:list')")
    @GetMapping("/list")
    public TableDataInfo list(PlError plError)
    {
        startPage();
        List<PlError> list = plErrorService.selectPlErrorList(plError);
        return getDataTable(list);
    }

    /**
     * 导出批量录数据错误 列表
     */
    @PreAuthorize("@ss.hasPermi('system:plError:export')")
    @Log(title = "批量录数据错误 ", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(PlError plError)
    {
        List<PlError> list = plErrorService.selectPlErrorList(plError);
        ExcelUtil<PlError> util = new ExcelUtil<PlError>(PlError.class);
        return util.exportExcel(list, "批量录数据错误 数据");
    }

    /**
     * 获取批量录数据错误 详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:plError:query')")
    @GetMapping(value = "/{plErrorId}")
    public AjaxResult getInfo(@PathVariable("plErrorId") String plErrorId)
    {
        return AjaxResult.success(plErrorService.selectPlErrorByPlErrorId(plErrorId));
    }

    /**
     * 新增批量录数据错误 
     */
    @PreAuthorize("@ss.hasPermi('system:plError:add')")
    @Log(title = "批量录数据错误 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PlError plError)
    {
        return toAjax(plErrorService.insertPlError(plError));
    }

    /**
     * 修改批量录数据错误 
     */
    @PreAuthorize("@ss.hasPermi('system:plError:edit')")
    @Log(title = "批量录数据错误 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PlError plError)
    {
        return toAjax(plErrorService.updatePlError(plError));
    }

    /**
     * 删除批量录数据错误 
     */
    @PreAuthorize("@ss.hasPermi('system:plError:remove')")
    @Log(title = "批量录数据错误 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{plErrorIds}")
    public AjaxResult remove(@PathVariable String[] plErrorIds)
    {
        return toAjax(plErrorService.deletePlErrorByPlErrorIds(plErrorIds));
    }
}
